/* 
命令行处理
*/
export const getArgv = (params = []) => {
    /* 
    @param      params          参数key，['path',...]
    @return     {
        params[0]:value
        ,...
    }
    */
    const arr = process.argv.slice(2);
    const o = {};
    arr.map((value, idx) => {
        const keyName = params[idx];
        if (keyName) {
            o[keyName] = value;
        }
    })
    return o;
}
const getArgvs = () => {
    const argvs = process.argv.slice(2);
    const o = {};
    let i = 0;
    while (i < argvs.length) {
        const str = argvs[i].trim();
        if (str[0] === '-' && argvs[i+1]!== undefined) {
            o[str.substring(1)] = argvs[i + 1];
            i += 2;
        } else {
            i += 1;
        }
    }
    return o;
}